import CommonTable from '@/components/CommonTable';
import styles from './Stations.less';

const Stations = (props) => {
  const { type, dataSource } = props;
  const columns = [
    {
      title: '序号',
      dataIndex: 'number',
      width: 65,
      render: (text, record, index) => index + 1,
    },
    {
      title: '充电站',
      dataIndex: 'chargeStationName',
      ellipsis: true,
      width: 240,
    },
    {
      title: '距离下一站时间（分）',
      dataIndex: 'nextTimes',
      width: 175,
      align: 'center',
    },
    {
      title: '到下一站距离（km）',
      dataIndex: 'nextMileages',
      width: 170,
      align: 'center',
    },
  ];
  return (
    <div className={styles.stations}>
      <header className={styles.header}>
        {{ 0: '空载', 1: '重载' }[type]}
      </header>
      <section className={styles.section}>
        <CommonTable
          rowKey="stationId"
          pagination={false}
          columns={columns}
          dataSource={dataSource}
        />
      </section>
    </div>
  );
};

export default Stations;
